<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    function Animal(color) {
      this.color = color;
      this.run = function () {
        console.log("跑")
      }
    }
    Animal.prototype.eat = function () {
      console.log("吃")
    }

    function Dog() {
      this.sleep = function () {
        console.log("睡")
      }
    }
    // 
    function Cat(name) {
      this.name = name;
      this.jiao = function () {
        console.log("giao")
      }
      Animal.call(this, "黑色") //猫继承动物
      Dog.call(this)//猫继承狗
    }
    var tom = new Cat("汤姆")
    tom.run()
    // tom.eat()
      // 优点 实现多继承 ，可以传参
      // 缺点：只能继承父类构造函数内部的属性和方法，不能继承原型上的属性和方法
  </script>

</body>

</html>